<?php
/**
 * Created by PhpStorm.
 * User: Egg
 * Date: 2018/3/14
 * Time: 8:39
 */

namespace Admin\Controller;


use Admin\Model\UserLogic;
use Think\Auth;
use Think\Controller;

class LoginController extends Controller
{
    public function index()
    {
        if (session('?uid')) {
            redirect('./Admin/user_manager');
        }
        $this->display('./login');
    }

    public function exit_login()
    {
        session(null);
        $this->display('./login');
    }

    public function login()
    {
        if (!IS_POST) {
            \Common\Common\request_method_error();
            exit;
        }
        $username = $_POST['username'];
        $password = $_POST['password'];
        $logic = new UserLogic();
        $logic->login($username, $password);
    }

}